package com.eliza.room.db.dao

import androidx.lifecycle.LiveData
import androidx.room.*
import com.eliza.room.model.Student


/*-*- coding:utf-8 -*-
 * @Author  : debi
 * @Time    : 3/27/22
 * @Software: Android Studio
 */

@Dao
interface StudentDao {
    @Insert
    suspend fun insertStu(vararg stu: Student)

    @Delete
    suspend fun deleteStu(vararg stu: Student)

    @Update
    suspend fun updateStu(vararg stu: Student)

    @Query("SELECT * FROM Student")
    fun getAllStuList(): LiveData<List<Student>>//使用liveData 更新数据

    @Query("SELECT * FROM Student Where userId = :id ")
    suspend fun getStuById(id: Int): List<Student>

}